<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	    		xmlns:ui="http://java.sun.com/jsf/facelets"
	  			xmlns:h="http://java.sun.com/jsf/html"
	  			xmlns:f="http://java.sun.com/jsf/core"                
                xmlns:cs="http://myfaces.apress.com/custom"
				template="/WEB-INF/layouts/standard.xhtml"
				xmlns:a4j="http://richfaces.org/a4j"
				xmlns:rich="http://richfaces.org/rich"
				xmlns:c="http://java.sun.com/jstl/core"
				xmlns:bf="http://www.bssmanager.com/jsf"
				xmlns:fn="http://www.bss.com/functions">

	<ui:define name="headIncludes">		
		<script type="text/javascript">
			var childW = null;
	
			function launchChildW() {
				
			  var url = "${request.contextPath}/webcam.jsp";
			   
			  wopts  = 'width=300,height=300,resizable=1,alwaysRaised=1,scrollbars=1,modal=yes';
	
			  if (window.showModalDialog) {
					window.showModalDialog(url,self,wopts);
				} else {
					window.open(url,'Popup',wopts);
				}
			}
						
			function setImage(im) {
				// This should match to the loadClickedImageFunction attribute in the bf:patient 
				loadClickedImage();							            
			}
		</script>					
	</ui:define>
	
	<ui:define name="formheader">
		<h2>Patients</h2>
	</ui:define>

	<ui:define name="content">
						
			<h:messages errorClass="errors" style="color:#ff1111" />
						
			<h:form id="#{patientController.modelName}form">
				<rich:panel style="border:0px; width:100%">							
					<bf:patient model="#{patientController.model}" 
								showAddUpdateCancel="true" 
								editing="#{patientController.editing}"
								showData="true"
								countryChangeAction="selectCountry"
								countrySuggestions="#{countryDao.all}"
								stateChangeAction="selectState"
								stateSuggestions="#{fn:call(stateDao,'findForCountry',patientController.model.country)}"										
								placeSuggestions="#{fn:call(placeDao,'findForState',patientController.model.state)}"
								data="#{patientController.data}"							
								controller="#{patientController}"
								loadClickedImageFunction="loadClickedImage"/>								
				</rich:panel>	
			</h:form>
			
	</ui:define>
</ui:composition>